#!/bin/bash
if type -p java;
then
    echo "Java has been installed."
else
    echo "start install"
    java=/opt/software/jdk8

    wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"
# This sentence is copied 

    mkdir -p ${java}
    tar -xvf jdk-8u141-linux-x64.tar.gz -C ${java} --strip-components 1
    echo "export PATH=$PATH:${java}/bin" >> /etc/profile
    source /etc/profile
    echo "install complete"
fi

